package com.opensky.qatest.ui.component;

import org.openqa.selenium.By;

import com.opensky.qatest.util.selenium.WebDriverWrapper;

public class JoinPageSignUpForm {

    // ************************ Locators ************************

    public static final String FIRST_NAME_INPUT = "registration_user_firstName";

    public static final String LAST_NAME_INPUT = "registration_user_lastName";

    public static final String EMAIL_INPUT = "registration_user_email";

    public static final String PASSWORD_INPUT = "registration_user_plainPassword";
    
    private static final String CATEGORIES = "//div[@class='category-follow']";

    private static final String FACEBOOK_LINK = "//a[contains(., 'Log In With Facebook')]";

    private static final String TERMS_LINK = "//div[@class='terms']/label[contains(., 'terms')]";
    
    private static final String START_SHOPPING_BTN = "submit";

    private final WebDriverWrapper driver;

    public JoinPageSignUpForm(WebDriverWrapper driver) {
	this.driver = driver;
    }

    // ************************ Actions **************************

    // ************************ Validations **************************

    public boolean isBaseElementsPresent() {

	driver.waitAndCheckElementPresent("FIRST_NAME_INPUT", By.id(FIRST_NAME_INPUT));
	driver.waitAndCheckElementPresent("LAST_NAME_INPUT", By.id(LAST_NAME_INPUT));
	driver.waitAndCheckElementPresent("FIRST_NAME_INPUT", By.id(FIRST_NAME_INPUT));
	driver.waitAndCheckElementPresent("FIRST_NAME_INPUT", By.id(FIRST_NAME_INPUT));
	
	driver.waitAndCheckElementPresent("CATEGORIES", By.xpath(CATEGORIES));
	driver.waitAndCheckElementPresent("FACEBOOK_LINK", By.xpath(FACEBOOK_LINK));
	driver.waitAndCheckElementPresent("TERMS_LINK", By.xpath(TERMS_LINK));
	driver.waitAndCheckElementPresent("START_SHOPPING_BTN", By.name(START_SHOPPING_BTN));

	return true;
    }

    // ************************ GET/SET methods **************************

}
